package test01;

/**
 * @Auther: xiaofei
 * @Date: 2021/6/8 - 06 - 08 - 11:35
 * @Description: test01
 * @version: 1.0
 */
public class Stduent {
    //属性
    private  int age;
    private String name;
    private String sex;
    //方法

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        if ("男".equals(sex) || "女".equals(sex)){
            this.sex = sex;
        }else{
            this.sex = "男";
        }
    }

    //构造器

    public Stduent() {
    }

    public Stduent(int age, String name, String sex) {
        this.age = age;
        this.name = name;
        this.setSex(sex);
    }
}
